//
//  OnlineVideoAssetModel.m
//  ShangHaiHuDongApp
//
//  Created by apple on 17/9/4.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "OnlineVideoAssetModel.h"

@implementation OnlineVideoAssetModel

-(void)calculateCellTitleSize{
    if ( self.CREATETIME.length > 0) {
        self.CREATETIME = [NSDateFormatter ybFormatterDateStringWithoutHourAndMinWithDateString:[NSString stringWithFormat:@"%@" , self.CREATETIME]];
    }
    if (self.titleString.length > 0) {
        self.titleAttributedString = [[NSMutableAttributedString alloc]initWithString:self.titleString];
        NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc]init];
        [paragraphStyle setLineSpacing:ItemHeight * 14];
        self.titleSize = [self.titleString boundingRectWithSize:CGSizeMake(ItemWidth * 407, ItemHeight * 140) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : LYPFONT(16) , NSParagraphStyleAttributeName : paragraphStyle} context:nil].size;
        paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail;
        [self.titleAttributedString addAttribute:NSFontAttributeName value:LYPFONT(16) range:NSMakeRange(0, self.titleString.length)];
        [self.titleAttributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, self.titleString.length)];
    }
    else{
        self.titleAttributedString = [[NSMutableAttributedString alloc]initWithString:@""];
    }
}


+ (NSDictionary *)modelCustomPropertyMapper {
    return @{@"titleString" : @"NAME"};
}

@end
